import 'package:enterprise_v6_app/app/components/custom_refresh.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/task/base_risk_object_entity.dart';
import 'package:enterprise_v6_app/router/app_pages.dart';

///安全风险辨识管理审签
class RiskControlApproveController extends GetxController {
  /// 列表刷新key
  final GlobalKey<CustomEasyRefreshListState> globalKey = GlobalKey();

  /// 筛选右侧栏控制Key
  final riskRightScaffoldKey = GlobalKey<ScaffoldState>();

  Future<List<BaseRiskObjectEntity>> getObjectAllByCompanyCode(int index, int size, {String? search}) async {
    final res = await HttpUtil().generateGetRequest<List<BaseRiskObjectEntity>>(Interface.getObjectAllByCompanyCode, queryParameters: {
      'isApprovalPage': 1, //是否查询审批数据 1是 0否
    }).execute();
    List<BaseRiskObjectEntity>? list = [];
    res.onSuccess((result) {
      if (result.data != null) {
        list = result.data;
      }
    });
    return list!;
  }

  /// 进入条目详情
  void itemDetail(BaseRiskObjectEntity item) {
    Get.toNamed(AppRoutes.riskControlApproveDetailPage, arguments: item);
  }
}
